<%@ page contentType="text/html; charset=gb2312" language="java"%>
<%@ page import="com.jspsmart.upload.*"  errorPage=""%>
<%@ page import="java.util.*"%>
<%@ page import="java.io.*"%>
<%@ page import="lib.*" %>
<%@ page import="tools.*" %>
<%@page import="ChartDirector.*" %>
<%@page import="label.*" %>
<%@page import="simuspec.*" %>

  
<%
	if(request.getParameter("input_pepstr")!=null)
	{
        String peptide=request.getParameter("input_pepstr");
        String weka_file="D:/Program Files/Apache Software Foundation/Tomcat 7.0/webapps/SpecSimulate/file/weca.result";
        
        SimuSpect simu=new SimuSpect(peptide,weka_file);
        simu.setPeakGroup();
        //out.print(weka_file+"#");
        //out.print(SimuSpect.peakGroup.length+"#");
        //for(double[] iter_peak:SimuSpect.peakGroup)
        {
        	//out.println(iter_peak[0]+"\t"+iter_peak[1]);
        	%>
        	<br/>
        	<% 
        }
	}
	else
	{
	    out.print(request.getParameter("input_pepstr"));
	}
	
 
 WebChartViewer viewer=new WebChartViewer(request,"chart1");
if(viewer.isPartialUpdateRequest())
{
	SpChart.processPartialUpdate(viewer);
	out.clear();
	viewer.partialUpdateChart(response);
	return;
}
else
{
	SpChart.createFirstChart(viewer);
}
 

%>

<html>
<head>
<script type="text/javascript" src="cdjcv.js"></script>
</style>
		
</head>
<body onload="initJsChartViewer()">
<script type="text/javascript">

function initJsChartViewer()
{
    // Check if the Javascript ChartViewer library is loaded
    if (!window.JsChartViewer)
    { 
       document.write("no");
        return;
     }
   
    var viewer = JsChartViewer.get('<%=viewer.getId()%>');
   
    connectViewerMouseUsage('ViewerMouseUsage1', viewer);
    
    connectViewerZoomControl(viewer);
   
    if (JsChartViewer.canSupportPartialUpdate())
    {
        viewer.attachHandler("ViewPortChanged", viewer.partialUpdate);
        document.getElementById('SubmitButton').onclick = function() { viewer.partialUpdate(); return false; };
    }
    else
    {
        viewer.attachHandler("ViewPortChanged", function() { document.forms[0].submit(); });
     }
}

</script>
<script type="text/javascript">
 function connectViewerMouseUsage(controlId, viewer)
            {  
              // A cross browser utility to get the object by id.
                function getObj(id) 
                {
                 return document.getElementById ? document.getElementById(id) : document.all[id]; 
                 }
                // Set the Javascript ChartViewer mouse usage mode if a button is clicked.
                getObj(controlId + "_Scroll").onclick = function() { viewer.setMouseUsage(JsChartViewer.Scroll); }
                getObj(controlId + "_ZoomIn").onclick = function() { viewer.setMouseUsage(JsChartViewer.ZoomIn); }
                getObj(controlId + "_ZoomOut").onclick = function() { viewer.setMouseUsage(JsChartViewer.ZoomOut);}
            }

function connectViewerZoomControl(viewer)
            {
				function setViewerDirection(d)
                {
                    viewer.setScrollDirection(d);
                    viewer.setZoomDirection(d);
                }

               setViewerDirection(JsChartViewer.HorizontalVertical); 
            }
</script>

<form method="post">
<table id="ViewerMouseUsage1" cellspacing="0" cellpadding="0" width="100%" border="0">
                <tr>
                    <td>
                        <div id="ViewerMouseUsage1_Scroll"title="Pointer">
                            <img src="icon/pointer.gif" style="vertical-align:middle" width="16" height="16" alt="Pointer" />  Pointer
                        </div>
                    </td>
               
                    <td>
                        <div  id="ViewerMouseUsage1_ZoomIn" title="Zoom In">
                            <img src="icon/zoomin.gif" style="vertical-align:middle" width="16" height="16" alt="Zoom In" />  Zoom In
                        </div>
                    </td>
               
                    <td>
                        <div id="ViewerMouseUsage1_ZoomOut" title="Zoom Out">
                            <img src="icon/zoomout.gif" style="vertical-align:middle" width="16" height="16" alt="Zoom Out" />  Zoom Out
                        </div>
                    </td>
                </tr>
            </table>
            </form>

	<%=viewer.renderHTML(response)%>
<form name="form2" method="post">
			<input type="checkbox" name="y_ion" />
			y-ion
			<input type="checkbox" name="b_ion" />
			b-ion
			<input type="checkbox" name="iso_ion" />
			iso-ion
			<input type="checkbox" name="NH3_ion" />
			NH3-loss
			<input type="checkbox" name="H2O_ion" />
			H2O-loss
			<input type="submit" name="update" value="update" />

		</form>
		
  </body>
  </html>     

